'use strict';

const axios = require('axios');

const BASE_URL = 'http://127.0.0.1:7001';


axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';

// 创建axios实例
const request = axios.create({
  // axios中请求配置有baseURL选项，表示请求URL公共部分
  baseURL: BASE_URL,
  // 超时
  timeout: 5000
})

// response拦截器
request.interceptors.response.use(res => {
    return res.data;
  }, error => {
    // console.log(error);
    Promise.reject(error);
  })

module.exports = request;
